/**
 * Created by Administrator on 14-1-6.
 */
(function($) {
    var arkflow = $.arkflow;
    arkflow.PathBigPointStrategy = arkflow.PathPointStrategy.extend({
        constructor : function(point) {
            this.base("big", point);
        },
        dragable: function() {
            return true;
        },
        createPoint:function() {
            return this.paper.rect(this.point.centerNode.x - this.path.attr.bigDot.width / 2,
                this.point.centerNode.y - this.path.attr.bigDot.height / 2,
                this.path.attr.bigDot.width,
                this.path.attr.bigDot.height).attr(this.path.attr.bigDot);
        },
        doMoveTo: function(x, y) {
            if (this.point.rightNode && this.point.rightNode.right() && this.point.rightNode.right().type() == "to") {
                this.point.rightNode.right().pos(arkflow.util.connPoint(this.toEvent.getBBox(), this.point.centerNode));
            }
            if (this.point.leftNode && this.point.leftNode.left() && this.point.leftNode.left().type() == "from") {
                this.point.leftNode.left().pos(arkflow.util.connPoint(this.fromEvent.getBBox(), this.point.centerNode));
            }
            if (this.point.rightNode && this.point.rightNode.right()) {
                this.point.rightNode.pos(this.center(this.point.centerNode, this.point.rightNode.right().pos()));
            }
            if (this.point.leftNode && this.point.leftNode.left()) {
                this.point.leftNode.pos(this.center(this.point.centerNode, this.point.leftNode.left().pos()));
            }
            var S = {
                x : this.point.centerNode.x,
                y : this.point.centerNode.y
            };
            if (this.isLine(this.point.leftNode.left().pos(), S, this.point.rightNode.right().pos())) {

                this.point.bindStrategy("small");
                this.point.rect.attr(this.path.attr.smallDot);
                this.point.pos(S);
                var P = this.point.leftNode;
                this.point.leftNode.left().right(this.point.leftNode.right());
                this.point.leftNode = this.point.leftNode.left();
                P.remove();
                var R = this.point.rightNode;
                this.point.rightNode.right().left(this.point.rightNode.left());
                this.point.rightNode = this.point.rightNode.right();
                R.remove();
            };
        }
    });
})(jQuery);